package com.dili.dd.gpi.service;

import com.dili.dd.gpi.domain.GciSnapshot;
import com.dili.dd.gpi.enums.ApplyType;
import com.dili.dd.gpi.enums.GCIType;
import com.dili.dd.gpi.exception.BusinessException;
import com.dili.dd.gpi.util.Pagination;
import com.dili.dd.gpi.util.spring.DataSourceLookupKey;
import com.dili.dd.gpi.util.spring.RequireDataSource;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by zhaoYuan on 2015/3/24.
 */
public interface GciSnapshotService {

    /**
     * 申请内容标注
     * @param titles
     * @param type
     * @param descriptions
     * @param gciSnapshots 用来接收已经存在的内容标注
     * @param newGcis 用来接收申请的内容标注
     * @return 申请成功返回true。失败返回false
     */
    @RequireDataSource(key = DataSourceLookupKey.GPI_DATASOURCE)
    boolean apply(Set<String> titles, GCIType type, String prefix, String suffix, List<String> descriptions,
                  List<GciSnapshot> gciSnapshots, List<GciSnapshot> newGcis, ApplyType applyType) throws BusinessException;

    /**
     * 获取gci列表
     * @param params
     * @param pagination
     * @return
     */
    @RequireDataSource(key = DataSourceLookupKey.GPI_DATASOURCE)
    List<GciSnapshot> find( Map<String,Object> params,Pagination pagination);

    /**
     * 检查title指定的gpi是否存在，如果存在，返回该gpi信息
     * @param titles
     * @param type
     * @return 如果title存在，返回该title对应的GpiSnapshot。否则返回空
     */
    @RequireDataSource(key = DataSourceLookupKey.GPI_DATASOURCE)
    List<GciSnapshot> isExist(List<String> titles, GCIType type);
}
